package com.kstech.exccheck.fragment;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.kstech.exccheck.R;

import java.util.ArrayList;
import java.util.LinkedList;

/**
 * Created by lenovo on 2016/10/13.
 */
class MyAdapter extends RecyclerView.Adapter {
    private LinkedList<String> values;
    public MyAdapter(LinkedList<String> values) {
        this.values = values;
    }

    class ViewHolder extends RecyclerView.ViewHolder {
        private TextView tv1;

        public ViewHolder(View root) {
            super(root);
            tv1 = (TextView) root.findViewById(R.id.tv1);
        }

        public TextView getTv1() {
            return tv1;
        }

    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(View.inflate(parent.getContext(), R.layout.rv_item, null));
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ViewHolder vh = (ViewHolder) holder;
        vh.getTv1().setText(values.get(position));
    }

    @Override
    public int getItemCount() {
        return values.size();
    }
}
